<?php

function P($param) {
    echo '<pre>';
    print_r($param);
    echo '</pre>';
}

if (!empty($_POST)) {
//默认就是5*8的数组
    $x = 8;
    $y = 5;
    $array = array();

//填充数组
    for ($index = 0; $index < $x; $index++) {
        for ($index1 = 0; $index1 < $y; $index1++) {
            $array[$index][$index1] = 0;
        }
    }

    $start_x = 0;
    $start_y = 0;
    $end_x = $x - 1;
    $end_y = $y - 1;


//最开始的是A，最后是B
    $start = $array[$start_x][$start_y] = 'A';
    $end = $array[$end_x][$end_y] = 'B';

    $ids = $_POST['ids'];
    if (!empty($ids)) {
        $key_array = array();
        //吧元素处理成数组
        foreach ($ids as $k => $v) {
            $key_array = explode("|", $v);
            $array[$key_array['0']][$key_array['1']] = 1; //吧阻塞参数填充到数组开面
        }
    }

//  0是以走，1是强


    $ee = $rr->zx($start_x, $start_y, $end_x, $end_y, $array);

    if (empty($ee)) {
        echo "无路可走";
    } else {
        echo "最有路径需要" . $rr->i;
    }
}


